//
//$Id: fa_utils.h 679 2011-03-12 16:50:06Z andrew.tsyganov $
#pragma once

//#include "stdafx.h"
#include "re.h"
#include "fa.h"


void Reverse(FA const& fa, FA& rfa);
void Determinize(FA const& fa, FA& dfa, std::vector<Subset>& vs_fa);
bool AreIsomorphicDFAs(FA const& dfa1, FA const& dfa2, std::vector<u_t>& vu);
bool AreEquivalentDFAs(FA const& dfa1, FA const& dfa2);
bool AreEquivalentFAs(FA const& dfa1, FA const& dfa2);
void MinimizeBrzozowski(FA const& fa, FA& mdfa);
void MinimizeHopcroft(FA const& dfa, FA const& rdfa, FA& mdfa, std::vector<Subset>& vs_dfa);

void GetSubAutomatonByStates(FA const& a, Subset const& s, FA& sa);
void ConvertToTransitionsVector(FA const& a, std::vector<Transition>& vt);
void GetSubAutomatonByTransitions(std::string const& name, std::vector<Transition> const& vt, Subset const& in, Subset const& fin, Subset const& s, FA& sa);

bool GetFA(std::string const& file, FA& fa);
bool LoadFAs(std::vector<FA>& v_fa, std::string const& dir);
bool SaveFAs(std::vector<FA>& v_fa, std::string const& dir);

inline void Merge(std::vector<Subset>& sets, Subset& available_sets, u_t i, u_t j);
inline u_t Find(std::vector<Subset> const& sets, Subset const& available_sets, u_t i);
void PrintSets(std::vector<Subset> const& sets, Subset const& available_sets);

//EOF!
